setSound

@NonNull
open fun setSound(@Nullable sound: @Nullable Uri): @NonNull NotificationCompat.Builder(source)

Set the sound to play. It will play on the default stream.

On some platforms, a notification that is noisy is more likely to be presented as a heads-up notification.

On platforms O and above this value is ignored in favor of the value set on the notification's channel. On older platforms, this value is still used, so it is still required for apps supporting those platforms.

See also


@NonNull
open fun setSound(@Nullable sound: @Nullable Uri, streamType: Int): @NonNull NotificationCompat.Builder(source)

Set the sound to play. It will play on the stream you supply.

On some platforms, a notification that is noisy is more likely to be presented as a heads-up notification.

On platforms O and above this value is ignored in favor of the value set on the notification's channel. On older platforms, this value is still used, so it is still required for apps supporting those platforms.

See also